
package com.insigma.business.qrcode.intell.service.impl;

import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.intell.dao.UserDao;
import com.insigma.business.qrcode.intell.dto.UserBSearcher;
import com.insigma.business.qrcode.intell.entity.UserDO;
import com.insigma.business.qrcode.intell.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    private UserDao userDao;
    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    
    @Override
    public List<UserDO> search(final UserBSearcher userBSearcher) {
        return userDao.search(userBSearcher);
    }
   
    @Override
    public UserDO get(final String id){
        return userDao.get(id);
    }

    
    @Override
    public UserDO getByAccount(final String account) {
        return userDao.getByAccount(account);
    }

    
    @Override
    public Integer insert(final UserDO userDO){
        userDO.setId(sequenceGenerator.genKey("USER_ID"));
        userDO.setCreatorId(userDO.getId());
        return userDao.insert(userDO);
    }

    
    @Override
    public Integer update(final UserDO userDO){
        return userDao.update(userDO);
    }

    
    @Override
    public Integer delete(final String id, final String modifierType, final String modifierId){
        return userDao.delete(id,modifierType,modifierId);
    }

}
